//
//  ControllerData.m
//  Words2
//
//  Created by Mathieu Tozer on 24/09/06.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import "ControllerData.h"
#import "WordsAppDelegate.h"


@implementation ControllerData

-(NSMutableDictionary *)languageGroupSelectionDictionary{
	NSData *dictData; //not doing caching
	dictData = [self valueForKey:@"languageGroupSelectionData"];
	if( dictData != nil){
		languageGroupSelectionDictionaryCache = [[NSKeyedUnarchiver unarchiveObjectWithData:dictData] retain];
	}else{
		languageGroupSelectionDictionaryCache = [[NSMutableDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"Group Name"] forKeys:[NSArray arrayWithObject:@"Language"]];
	}
	
	return languageGroupSelectionDictionaryCache;
	
}

-(void)setLanguageGroupSelectionDictionary:(NSMutableDictionary *)newDict{
	if (languageGroupSelectionDictionaryCache != newDict){
		[languageGroupSelectionDictionaryCache release];
		
		if(newDict == nil){
			NSLog(@"newDict was nil");
		}
		
		//cache and archive in managedObject.
		languageGroupSelectionDictionaryCache = [newDict retain];
		NSData *dictData = [NSKeyedArchiver archivedDataWithRootObject:newDict];
		[self setValue:dictData forKey:@"languageGroupSelectionData"];
	}
}



@end
